import {updateFile} from '../../utils/http/index.js'
const baseUrl = 'http://ls.ngrok2.xiaomiqiu.cn/'


export const uploadImg = (data,callback)=>{
   uni.chooseImage({
       count: data, //默认9
       sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
       success: function (res) {
		   console.log(res)
   		let tempFilePaths = res.tempFilePaths
		let list = []
		tempFilePaths.forEach(async (v,i)=>{
			const bp = await updateFile(v)
			list.push(`${baseUrl}${bp}`)
			if(list.length == tempFilePaths.length){
				callback(list)
			}
		})
		
		
       }
   });
}